/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author QUY_THI
 */
@Entity
@Table(name = "Deposits")
@NamedQueries({
    @NamedQuery(name = "Deposit.findAll", query = "SELECT d FROM Deposit d"),
    @NamedQuery(name = "Deposit.findByDepositID", query = "SELECT d FROM Deposit d WHERE d.depositID = :depositID"),
    @NamedQuery(name = "Deposit.findByAmount", query = "SELECT d FROM Deposit d WHERE d.amount = :amount"),
    @NamedQuery(name = "Deposit.findByDepositDate", query = "SELECT d FROM Deposit d WHERE d.depositDate = :depositDate")})
public class Deposit implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "DepositID")
    private Integer depositID;
    @Basic(optional = false)
    @Column(name = "Amount")
    private BigDecimal amount;
    @Column(name = "DepositDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date depositDate;
    @JoinColumn(name = "AccountCode", referencedColumnName = "AcountCode")
    @ManyToOne
    private Account account;

    public Deposit() {
    }

    public Deposit(Integer depositID) {
        this.depositID = depositID;
    }

    public Deposit(Integer depositID, BigDecimal amount) {
        this.depositID = depositID;
        this.amount = amount;
    }

    public Integer getDepositID() {
        return depositID;
    }

    public void setDepositID(Integer depositID) {
        this.depositID = depositID;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Date getDepositDate() {
        return depositDate;
    }

    public void setDepositDate(Date depositDate) {
        this.depositDate = depositDate;
    }

    public Account getAccount() {
        return account;
    }

    public void setAccount(Account account) {
        this.account = account;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (depositID != null ? depositID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Deposit)) {
            return false;
        }
        Deposit other = (Deposit) object;
        if ((this.depositID == null && other.depositID != null) || (this.depositID != null && !this.depositID.equals(other.depositID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Deposit[depositID=" + depositID + "]";
    }

}
